/* $Rev: 144 $ */

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

#include "md5.h"
#include "md5_utils.h"

int main(int argc, char *argv[]) {
	char *hexa = NULL;
	FILE *f = NULL;
	struct stat stat_res;

	assert(argc == 2);
	assert(argv[1] != NULL);

	f = fopen(argv[1], "r");
	assert(f != NULL);
	fstat(fileno(f), &stat_res);
	fclose(f);

	hexa = slice_md5(argv[1], 0, stat_res.st_size);
	printf("MD5 for %s: %s\n", argv[1], hexa);
	free(hexa);

	return 0;
}
